package com.ruoyi.system.designpattern.visitor;

import java.util.ArrayList;
import java.util.List;

// 对象结构
public class Store {
    private List<Element> products = new ArrayList<>();
    
    public void addProduct(Element product) {
        products.add(product);
    }
    
    public void removeProduct(Element product) {
        products.remove(product);
    }
    
    public void accept(Visitor visitor) {
        for (Element product : products) {
            product.accept(visitor);
        }
    }
}
